<template>
	<view class="conter">
		<!-- <header-box :title="title"></header-box> -->
		<view class="header" style="color: #000000;" @tap="goBack(id)">
			<view class="arrow">
			</view>
			<view class="title">
				{{title}}
			</view>
		</view>
		
		<view class="text-tab">
			<view class="box">
				<view class="marige-bor" v-for="(item, index) in textList" :key="index">
					<view class="diso-flex">
						<view class="">
							{{item.name}}
						</view>
						<view class="conter-image" @tap="skip(item)">
							<u-radio-group v-model="value">
								<u-radio active-color="#AFB3F1" :name="item.name" ></u-radio>
							</u-radio-group>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		
		<navigator url="/pages/contact/individual" class="add">
			<image src="../../static/index/add.png" mode=""></image>
		</navigator>

	

		<view class="flex-box total">
			<view class="">
				合计：
			</view>
			<view class="">
				{{total}} 个
			</view>
		</view>

	</view>
</template>

<script>
	import headerBox from '../../components/header/header.vue'

	export default {
		components: {
			headerBox
		},
		data() {
			return {
				title: '往来单位',
				textList: [],
				addUrl: '',
				total: 0,
				value: '',
			}
		},
		onLoad() {
			this.stockList()
		},
		onShow() {
			this.stockList()
		},
		methods: {
			
			goBack(name) {
				console.log(name)
				// uni.navigateTo({
				// 	url: '/pages/putStock/addShop?name=' + name
				// })
				
				uni.navigateBack({
					delta: 1
				})
				
				let pages = getCurrentPages(); //获取所有页面栈实例列表
				let nowPage = pages[pages.length - 1]; //当前页页面实例
				let prevPage = pages[pages.length - 2]; //上一页页面实例
				prevPage.$vm.searchVal = this.name; //修改上一页data里面的searchVal参数值为1211
				prevPage.$vm.danweiID = this.danweiID;
			
			},
			
			async stockList() {
				const res = await this.$u.post("api/jinxiao.Company/index");
				this.textList = res.data
				this.total = res.data.length
				this.danweiID = res.data[0].id
				console.log(this.value, 'this.value')
			},
			
			skip(item) {
				console.log('跳转',item)
				this.name = item
				this.danweiID = item.id
				// this.value = item.id
				// uni.navigateTo({
				// 	url: '/pages/contact/remove?item=' + item.id
				// });
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.conter {
		width: 100%;
		height: 100%;
		position: relative;
		
		
		.header {
			width: 100%;
			height: 150rpx;
			line-height: 150rpx;
			display: flex;
			align-items: center;
			// padding-left: 10rpx;
			padding-top: 30rpx;
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			background: linear-gradient(to right, #656CE6, #9397FC);
			
			.arrow{
			  position: relative;
			  display: inline-block;
			}
			
			.arrow::before{
			  content: '';
			  width: 10px;
			  height: 10px;
			  border: 0px;
			  border-bottom: solid 2px #fff;
			  border-left: solid 2px #fff;
			  -ms-transform: rotate(45deg);
			  -webkit-transform: rotate(45deg);
			  transform: rotate(45deg);
			  position: absolute;
			  top: 50%;
			  left: 0;
			  margin-top: -4px;
			  margin-left: 28rpx;
			}
			
			.title {
				color: #fff;
				margin: 0 auto;
			}
		}
		
		
		// 加号
		.add {
			position: absolute;
			bottom: 200rpx;
			right: 40rpx;
			width: 140rpx;
			height: 140rpx;
			text-align: center;
			line-height: 100rpx;
			border-radius: 50%;
			font-size: 100rpx;
		}
		
		

		image {
			width: 100%;
			height: 100%;
		}

		.text-tab {
			width: 100%;
			padding: 30rpx;
			padding-bottom: 0;


			.box {
				width: 98%;
				margin: 0 auto;
				background-color: #FFFFFF;
				border-radius: 10rpx;
			}

			.marige-bor {
				width: 90%;
				margin: 0 auto;
				color: #333333;
				display: flex;
				font-size: 28rpx;
				align-items: center;
				border-bottom: 1rpx solid #F0F0F0;
				justify-content: space-between;

				.diso-flex {
					width: 100%;
					height: 80rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
				}

				.conter-image {
					width: 22rpx;
					height: 36rpx;
				}
			}
			
			.marige-bor:last-child {
				border-bottom: 0;
			}
		}


		.total {
			width: 100%;
			position: absolute;
			bottom: 0;
			left: 0;
			height: 100rpx;
			padding: 0 60rpx 0 30rpx;
			background-color: #FFFFFF;
		}

	}
</style>
